#include<func.h>
int main()
{
    pid_t pid;
        pid=fork();
    if(pid<0)
    {
        printf("fork error");
    }
    else if(0==pid)
    {

        printf("i am child,my pid is %d,ppid=%d\n",getpid(),getppid()); 
        exit(0);
    }
    else
    {
        printf("i am parent,my child pid is%d,my pid is %d,ppid=%d\n",pid,getpid(),getppid());
        int status;
        pid=wait(&status);
        if(WIFEXITED(status))
        {
            printf("child exit code=%d\n",WEXITSTATUS(status));
        }
        else 
        {
            printf("child crash\n");
        }
        printf("wait pid=%d\n",pid);

        return 0;
    }
}